package com.msmall.community.admin.action;

import com.msmall.base.action.HTMLBaseAction;
import com.msmall.base.util.ConstantUrl;
import com.msmall.community.play.model.Play;
import com.msmall.community.play.service.PlayManager;

public class PlayAction extends HTMLBaseAction{
	  
	private static final long serialVersionUID = -1514663055247517410L;
	private Long playId;
	private Play play;
	private PlayManager playManager;

	public void setPlayManager(PlayManager playManager) {
		this.playManager = playManager;
	}
	
	public String execute(){
		page.setClazz(Play.class);
		page.setOrderBy("playId");
		page.setOrder("desc");
		playManager.getPagination(page);
		page.setUrl(ConstantUrl.ADMIN_PLAY_INDEX);
		return SUCCESS;
	}
	
	public String create(){
		playId = null;
		play = null;
		return SUCCESS;
	}
	
	public String update(){
		play = (Play) playManager.get(Play.class, playId);
		return SUCCESS;
	}
	
	public String save(){
		playManager.savePlay(play, getUserid());
		return SUCCESS;
	}

	public Long getPlayId() {
		return playId;
	}

	public void setPlayId(Long playId) {
		this.playId = playId;
	}

	public Play getPlay() {
		return play;
	}

	public void setPlay(Play play) {
		this.play = play;
	}
}
